package com.happyface.andquiz;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;

public class Main extends Activity {
    private Button btnNewGame;
    private Button btnSettings;
    private Button btnHighScores;
    private Button btnExitGame;

    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	setContentView(R.layout.main);

	this.initControls();
	this.initActions();
    }

    /**
     * Initialize main layout controls
     */
    private void initControls() {
	btnNewGame = (Button) findViewById(R.id.btnNewGame);
	btnHighScores = (Button) findViewById(R.id.btnHighScores);
	btnSettings = (Button) findViewById(R.id.btnSettings);
	btnExitGame = (Button) findViewById(R.id.btnExitGame);
    }

    /**
     * Initialize actions for main layout controls
     */
    private void initActions() {
	btnNewGame.setOnClickListener(new OnClickListener() {

	    public void onClick(View v) {
		// TODO Auto-generated method stub
		startNewGame(Main.this);
	    }
	});

	btnHighScores.setOnClickListener(new OnClickListener() {

	    public void onClick(View v) {
		// TODO Auto-generated method stub

	    }
	});

	btnSettings.setOnClickListener(new OnClickListener() {

	    public void onClick(View v) {
		// TODO Auto-generated method stub

	    }
	});

	btnExitGame.setOnClickListener(new OnClickListener() {

	    public void onClick(View v) {
		// TODO Auto-generated method stub

	    }
	});
    }

    /**
     * Starts the New Game activity
     * 
     * @param callingActivity
     *            the calling activity
     */
    private void startNewGame(Activity callingActivity) {
	Intent newGameIntent = new Intent(callingActivity,
		NewGameActivity.class);
	callingActivity.startActivity(newGameIntent);
    }
}